package com.guidinggame.service;

import java.util.HashMap;
import java.util.Map;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;

public class PreferencesService {

	private Context context;
	
	public PreferencesService(Context context) {
		this.context=context;
	}

	//保存设置信息
	public void save(Map<String, String> info){
		SharedPreferences preferences=
				context.getSharedPreferences("guidinggame", Context.MODE_PRIVATE);
		Editor editor=preferences.edit();
		editor.putString("name", info.get("name"));
		editor.commit();
	}
	
	//获取设置信息
	public Map<String, String> getPreferences(){
		Map<String, String> params=new HashMap<String, String>();
		SharedPreferences preferences=
				context.getSharedPreferences("guidinggame", Context.MODE_PRIVATE);
		params.put("name", preferences.getString("name",""));
		return params;
	}
}
